package com.situ.day2;

import org.junit.Test;

public class ForDemo {
	// i++   i = i +1
	@Test
	public void test1() {
		for (int i = 1; i <= 5; i++) {
			System.out.println("Hello World!");
		}
	}
	
	//  1+2+3+4+...+99+100=5050
	@Test
	public void test2() {
		int sum = 0;
		for (int i = 1; i <= 100; i++) {
			System.out.println(i);
			sum = sum + i;
		}
		System.out.println(sum);
	}
	
	// 计算1-100以内7的倍数的个数
	@Test
	public void test5() {
		int count = 0;
		for (int i = 1; i <= 100; i++) {
			// System.out.println(i);
			if (i % 7 == 0) {
				System.out.println(i + "是7的倍数");
				count = count + 1;
			}
		}
		System.out.println("1-100以内7的倍数的个数: " + count);
	}

	
	
	
}
